package org.springblade.modules.notice.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;
import org.springblade.modules.notice.vo.CommonEnumInfo;

import java.util.ArrayList;
import java.util.List;

/**
 * @Author ysq
 * @Date 2024/11/21
 * @Description 触发节点枚举
 */
@Getter
@AllArgsConstructor
public enum TriggerNodeEnum {

	CREATE(1,  "创建工单"),

	ASSIGN(2, "派单"),

	SIGN_IN(3, "签到"),

	SIGN_OUT(4, "签退"),

	APPROVE_PASS(5, "审批通过"),

	APPROVE_NOT_PASS(6, "审批不通过"),

	FINISH(7, "工单完成"),

	REMINDER(8, "催办"),

	CLOSE(9, "工单关闭"),

	REOPEN(10, "重新打开"),

	CANCEL(11, "工单撤销"),

	;

	private final Integer code;


	private final String desc;

	public static String getDesc(Integer code) {
		for (TriggerNodeEnum item : TriggerNodeEnum.values()) {
			if (item.getCode().equals(code)) {
				return item.getDesc();
			}
		}
		return null;
	}

	/**
	 * 获取可选列表
	 */
	public static List<CommonEnumInfo> getSelectList() {
		List<CommonEnumInfo> list = new ArrayList<>(16);
		for (TriggerNodeEnum value : values()) {
			list.add(new CommonEnumInfo(value.getCode(), value.getDesc()));
		}
		return list;
	}
}
